package com.kongwg.java;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @author kongwg
 * @create 2020-12-15 19:50
 */
public class PropertiesTest {

    public static void main(String[] args) {

        FileInputStream fis = null;
        try {
            Properties pros = new Properties();

            fis = new FileInputStream("jdbc.properties");

            pros.load(fis);

            String name = pros.getProperty("name");
            String password = pros.getProperty("password");

            System.out.println("name:" + name + "password: " + password);
        } catch (IOException e) {
            e.getMessage();
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.getMessage();
                }
            }
        }
    }
}
